<template>
<el-container style="height: 590px; border: 1px solid #eee">
<el-aside width="200px" style="background-color: rgb(238, 241, 246)">
  <el-menu :default-openeds="['1','2','3']">
    <el-submenu index="1">
      <template slot="title"><i class="el-icon-message"></i>导航一</template>
      <el-menu-item-group>
        <template slot="title">分组一</template>
        <el-menu-item index="1-1" @click="gotoindex">首页</el-menu-item>
      </el-menu-item-group>
      <el-menu-item-group title="分组2">
        <el-menu-item index="1-2" @click="gotopolicy">政策信息</el-menu-item>
        <el-menu-item index="1-3" @click="gotostubro">招生简章</el-menu-item>
      </el-menu-item-group>
<!--      <el-submenu index="1-4">-->
<!--        <template slot="title">选项4</template>-->
<!--      </el-submenu>-->
    </el-submenu>
    <el-submenu index="2">
      <template slot="title"><i class="el-icon-menu"></i>导航二</template>
      <el-menu-item-group>
        <template slot="title">分组一</template>
        <el-menu-item index="2-1" @click="gotoschool">院校库</el-menu-item>
        <el-menu-item index="2-2" @click="gotomajor">专业库</el-menu-item>
      </el-menu-item-group>
    </el-submenu>
    <el-submenu index="3">
      <template slot="title"><i class="el-icon-setting"></i>导航三</template>
      <el-menu-item-group>
        <template slot="title">问卷测评</template>
        <el-menu-item index="3-1">职业性格测试</el-menu-item>
        <el-menu-item index="3-2">行测</el-menu-item>
      </el-menu-item-group>
      <el-menu-item-group title="分组2">
        <el-menu-item index="3-3" @click="gotoselect">一分一档</el-menu-item>
        <el-menu-item index="3-4" @click="gotoindex">限选课</el-menu-item>
      </el-menu-item-group>
    </el-submenu>
  </el-menu>
</el-aside>

<el-container>
  <el-header style="text-align: right; font-size: 12px">
    <el-dropdown>
      <i class="el-icon-setting" style="margin-right: 15px"></i>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item @click.native="gotofatie">查看</el-dropdown-item>
        <el-dropdown-item @click.native="gotoschool">新增</el-dropdown-item>
        <el-dropdown-item>删除</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <span>王小虎</span>
  </el-header>

  <el-main>
    <el-table
      v-loading="loading"
      :data="tableData"
      border
      stripe>
      <el-table-column prop="type" label="类型" width="50">
      </el-table-column>
      <el-table-column prop="title" label="标题" width="120">
      </el-table-column>
      <el-table-column prop="content" label="内容">
      </el-table-column>
    </el-table>
  </el-main>
</el-container>
</el-container>
</template>

<style>
.el-header {
  background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>

<script>
import request from '../utils/request'
export default {
  data () {
    return {
      loading: true,
      tableData: [ ]
    }
  },
  created () {
    this.load()
  },
  methods: {
    load () {
      this.loading = true
      request.get('api/forum', {
      }).then(res => {
        this.loading = false
        this.tableData = res.data.records
        console.log(this.tableData)
      })
    },
    gotomajor () {
      this.$router.push({
        path: '/major'
      })
    },
    gotoindex () {
      this.$router.push({
        path: '/'
      })
    },
    gotoschool () {
      this.$router.push({
        path: '/school'
      })
    },
    gotoselect () {
      this.$router.push({
        path: '/selectone'
      })
    },
    gotolimitclass () {
      this.$router.push({
        path: '/limitclass'
      })
    },
    gotopolicy () {
      this.$router.push({
        path: '/policy'
      })
    },
    gotostubro () {
      this.$router.push({
        path: '/stubro'
      })
    },
    gotoforum () {
      this.$router.push({
        path: '/forum'
      })
    },
    gotofatie () {
      this.$router.push({
        path: '/fatie'
      })
    }
  }
}
</script>
